﻿<navigation:Page x:Class="Corina.Lantern.Hub.Views.Datas.DeviceMeasureView"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:be="clr-namespace:Corina.Interactivity.Silverlight;assembly=Corina.Interactivity.Silverlight"
                 xmlns:controls="clr-namespace:Corina.Controls.Silverlight;assembly=Corina.Controls.Silverlight"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
                 xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                 xmlns:localViewmodel="clr-namespace:Corina.Lantern.Hub.Viewmodels"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                 xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                 Style="{StaticResource PageStyle}"
                 d:DesignHeight="640"
                 d:DesignWidth="900"
                 mc:Ignorable="d">
    <navigation:Page.DataContext>
        <localViewmodel:DeviceMeasureViewmodel />
    </navigation:Page.DataContext>

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <ei:CallMethodAction MethodName="UILoaded" TargetObject="{Binding}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>

    <navigation:Page.Resources>
        <Style x:Key="style_labeltext" TargetType="TextBlock">
            <Setter Property="Width" Value="120" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="FontSize" Value="16" />
            <Setter Property="FontFamily" Value="STSong,宋体" />
            <Setter Property="FontWeight" Value="Bold" />
        </Style>

        <Style x:Key="style_label_search" TargetType="TextBlock">
            <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Right" />
        </Style>

        <Style x:Key="style_headertext" TargetType="TextBlock">
            <Setter Property="FontSize" Value="16" />
            <Setter Property="FontFamily" Value="STSong,宋体" />
            <Setter Property="FontWeight" Value="Bold" />
        </Style>

        <Style x:Key="style_inputbox_ext" TargetType="controls:TextBoxExt">
            <Setter Property="FontSize" Value="15" />
            <Setter Property="FontFamily" Value="STSong,宋体" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Grid.Column" Value="1" />
            <Setter Property="Margin" Value="0,5" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="controls:TextBoxExt">
                        <Grid>

                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0"
                                                             Storyboard.TargetName="FocusRectangle"
                                                             Storyboard.TargetProperty="(UIElement.Opacity)"
                                                             To="1" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0"
                                                             Storyboard.TargetName="FocusRectangle"
                                                             Storyboard.TargetProperty="(UIElement.Opacity)"
                                                             To="1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unfocused">
                                        <Storyboard />
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>

                            <Border BorderBrush="{StaticResource GrayBrush1}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Padding="3,0">

                                <Grid>
                                    <TextBlock Foreground="{StaticResource COLOR_LIGHTGRAY}"
                                               Text="{TemplateBinding PlaceText}"
                                               Visibility="{Binding Text.Length,
                                                                    Converter={StaticResource EuqalsToVisibilityConverter},
                                                                    RelativeSource={RelativeSource TemplatedParent},
                                                                    ConverterParameter=0}" />
                                    <ScrollViewer x:Name="ContentElement"
                                                  VerticalAlignment="Center"
                                                  Background="{x:Null}"
                                                  BorderThickness="0"
                                                  IsTabStop="False" />
                                </Grid>
                            </Border>
                            <Rectangle Name="FocusRectangle"
                                       Height="1"
                                       VerticalAlignment="Bottom"
                                       Fill="{TemplateBinding BorderBrush}"
                                       Opacity="0" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="style_delete_button" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid>
                            <Grid Background="White" Opacity="0" />
                            <Path Width="16"
                                  Height="16"
                                  Margin="0,0,0,0"
                                  Data="{Binding Converter={StaticResource StringToPathGeometryConverter},
                                                 Source={StaticResource ICON_CLEAN}}"
                                  Fill="{StaticResource COLOR_BLUE}"
                                  RenderTransformOrigin="0.5,0.5"
                                  Stretch="Uniform">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="0" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="style_inputbox" TargetType="TextBox">
            <Setter Property="FontSize" Value="15" />
            <Setter Property="FontFamily" Value="STSong,宋体" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Grid.Column" Value="1" />
            <Setter Property="Margin" Value="0,5" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBox">
                        <Grid>

                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0"
                                                             Storyboard.TargetName="FocusRectangle"
                                                             Storyboard.TargetProperty="(UIElement.Opacity)"
                                                             To="1" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0"
                                                             Storyboard.TargetName="FocusRectangle"
                                                             Storyboard.TargetProperty="(UIElement.Opacity)"
                                                             To="1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unfocused">
                                        <Storyboard />
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>

                            <Border BorderBrush="{StaticResource GrayBrush1}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Padding="3,0">
                                <ScrollViewer x:Name="ContentElement"
                                              VerticalAlignment="Center"
                                              Background="{x:Null}"
                                              BorderThickness="0"
                                              IsTabStop="False" />
                            </Border>
                            <Rectangle Name="FocusRectangle"
                                       Height="1"
                                       VerticalAlignment="Bottom"
                                       Fill="{TemplateBinding BorderBrush}"
                                       Opacity="0" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="style_headerbox" TargetType="TextBox">
            <Setter Property="FontSize" Value="24" />
            <Setter Property="FontFamily" Value="STHei" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Grid.Column" Value="1" />
            <Setter Property="Margin" Value="0,5" />
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBox">
                        <Grid>

                            <Border BorderBrush="{StaticResource GrayBrush1}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Padding="3,0">
                                <ScrollViewer x:Name="ContentElement"
                                              VerticalAlignment="Center"
                                              Background="{x:Null}"
                                              BorderThickness="0"
                                              IsTabStop="False" />
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="style_printitem" TargetType="ListBoxItem">
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="FontFamily" Value="STSong,宋体" />
            <Setter Property="FontSize" Value="16" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                                <ColumnDefinition />
                                <ColumnDefinition />
                                <ColumnDefinition MinWidth="150" />
                                <ColumnDefinition MinWidth="150" />
                                <ColumnDefinition Width="20" />
                            </Grid.ColumnDefinitions>

                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                           Duration="00:00:00.0010000"
                                                                           Storyboard.TargetName="deleteBtn"
                                                                           Storyboard.TargetProperty="(UIElement.Visibility)">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed" />
                                    <VisualState x:Name="Disabled" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>

                            <Grid Grid.ColumnSpan="7"
                                  Background="White"
                                  Opacity="0" />

                            <TextBlock FontFamily="{TemplateBinding FontFamily}"
                                       FontSize="{TemplateBinding FontSize}"
                                       Text="{Binding Name}" />
                            <TextBlock Grid.Column="1"
                                       FontFamily="{TemplateBinding FontFamily}"
                                       FontSize="{TemplateBinding FontSize}"
                                       Text="{Binding Density}" />
                            <TextBlock Grid.Column="2"
                                       FontFamily="{TemplateBinding FontFamily}"
                                       FontSize="{TemplateBinding FontSize}"
                                       Text="{Binding Temperature}" />
                            <TextBlock Grid.Column="3"
                                       FontFamily="{TemplateBinding FontFamily}"
                                       FontSize="{TemplateBinding FontSize}"
                                       Text="{Binding Specimen}" />
                            <TextBlock Grid.Column="4"
                                       Margin="0,0,0,6"
                                       FontFamily="{TemplateBinding FontFamily}"
                                       FontSize="{TemplateBinding FontSize}"
                                       Text="{Binding Guobiao}" />
                            <TextBlock Grid.Column="5"
                                       FontFamily="{TemplateBinding FontFamily}"
                                       FontSize="{TemplateBinding FontSize}"
                                       Text="{Binding TestTime,
                                                      StringFormat=\{0:yyyy-MM-dd HH:mm\}}" />
                            <Button Name="deleteBtn"
                                    Grid.Column="6"
                                    Style="{StaticResource style_delete_button}"
                                    Visibility="Collapsed">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <i:InvokeCommandAction Command="{Binding Path=DataContext.RemovePrintItemCommand, RelativeSource={RelativeSource AncestorType=navigation:Page}}" CommandParameter="{Binding Id}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="style_dataoption" TargetType="CheckBox">
            <Setter Property="FontSize" Value="14" />
            <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="CheckBox">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.Effect>
                                <DropShadowEffect BlurRadius="1"
                                                  Direction="-90"
                                                  Opacity="0.5"
                                                  ShadowDepth="1"
                                                  Color="{StaticResource ColorForegroundShadowColor}" />
                            </Grid.Effect>

                            <Ellipse Width="18"
                                     Height="18"
                                     Stroke="{StaticResource ControlForeground}" />

                            <Path Width="10"
                                  Height="10"
                                  Margin="0,0,0,0"
                                  Data="F1M181.297,177.841L181.205,177.746 181.385,177.563 202.804,156.146 202.804,135.07 178.497,159.373 170.847,167.026 170.666,167.205 163.107,159.653 138.804,135.345 138.804,156.42 160.219,177.841 170.76,188.379 181.297,177.841z"
                                  Fill="{TemplateBinding Foreground}"
                                  RenderTransformOrigin="0.5,0.5"
                                  Stretch="Uniform"
                                  Visibility="{Binding IsChecked,
                                                       Converter={StaticResource BooleanToVisibilityConverter},
                                                       RelativeSource={RelativeSource TemplatedParent}}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="0" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <Path Width="10"
                                  Height="10"
                                  Margin="0,0,0,0"
                                  Data="F1M753.644,-13.0589L753.736,-12.9639 753.557,-12.7816 732.137,8.63641 732.137,29.7119 756.445,5.40851 764.094,-2.24384 764.275,-2.42352 771.834,5.1286 796.137,29.4372 796.137,8.36163 774.722,-13.0589 764.181,-23.5967 753.644,-13.0589z"
                                  Fill="{TemplateBinding Foreground}"
                                  RenderTransformOrigin="0.5,0.5"
                                  Stretch="Uniform"
                                  Visibility="{Binding IsChecked,
                                                       Converter={StaticResource BooleanToVisibilityInverseConverter},
                                                       RelativeSource={RelativeSource TemplatedParent}}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="0" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <ContentControl Grid.Column="1"
                                            Margin="6,0,0,0"
                                            VerticalAlignment="Center"
                                            Content="{TemplateBinding Content}"
                                            FontSize="{TemplateBinding FontSize}"
                                            Foreground="{TemplateBinding Foreground}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </navigation:Page.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid Visibility="{Binding ShowPrintView, Converter={StaticResource BooleanToVisibilityInverseConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <toolkit:Expander Margin="0,12,0,0"
                              Background="{StaticResource COLOR_LIGHT}"
                              BorderBrush="{StaticResource DarkBorder}"
                              BorderThickness="1"
                              Header="搜索">
                <StackPanel>

                    <Grid Margin="0,12">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="12" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="80" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Style="{StaticResource style_label_search}" Text="仪器类别：" />
                            <sdk:AutoCompleteBox Grid.Column="1"
                                                 ItemsSource="{Binding DeviceKindCollection}"
                                                 MinimumPrefixLength="0"
                                                 SelectedItem="{Binding SelectedDeviceKind,
                                                                        Mode=TwoWay}"
                                                 TabIndex="0"
                                                 ValueMemberPath="Name"
                                                 be:AutoCompleteBoxHelper.OtherPaths="Name,Description">
                                <sdk:AutoCompleteBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Name}" />
                                    </DataTemplate>
                                </sdk:AutoCompleteBox.ItemTemplate>
                                <i:Interaction.Triggers>
                                    <be:AutoCompleteBoxTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:AutoCompleteBoxTrigger>
                                </i:Interaction.Triggers>
                            </sdk:AutoCompleteBox>
                        </Grid>

                        <Grid Grid.Column="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="80" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Style="{StaticResource style_label_search}" Text="序列号：" />
                            <controls:TextBoxExt Grid.Column="1"
                                                 PlaceText="设备序列号，例如:000000"
                                                 TabIndex="1"
                                                 Text="{Binding DeviceSn,
                                                                Mode=TwoWay,
                                                                UpdateSourceTrigger=PropertyChanged}">
                                <i:Interaction.Triggers>
                                    <be:TextBoxEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </controls:TextBoxExt>
                        </Grid>
                    </Grid>

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="12" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="80" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Style="{StaticResource style_label_search}" Text="检测项目：" />
                            <controls:TextBoxExt Grid.Column="1"
                                                 PlaceText="例如：二氧化硫"
                                                 TabIndex="2"
                                                 Text="{Binding MeasureName,
                                                                Mode=TwoWay,
                                                                UpdateSourceTrigger=PropertyChanged}">
                                <i:Interaction.Triggers>
                                    <be:TextBoxEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </controls:TextBoxExt>
                        </Grid>

                        <Grid Grid.Column="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="80" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Style="{StaticResource style_label_search}" Text="样品代号：" />
                            <controls:TextBoxExt Grid.Column="6"
                                                 PlaceText="例如：D01或D04等"
                                                 TabIndex="3"
                                                 Text="{Binding Tester,
                                                                Mode=TwoWay,
                                                                UpdateSourceTrigger=PropertyChanged}">
                                <i:Interaction.Triggers>
                                    <be:TextBoxEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </controls:TextBoxExt>
                        </Grid>
                    </Grid>

                    <Rectangle Height="1"
                               Margin="0,12"
                               Fill="{StaticResource COLOR_LIGHT}" />
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="12" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="80" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Style="{StaticResource style_label_search}" Text="浓度：" />
                            <TextBox Grid.Column="1"
                                     TabIndex="4"
                                     Text="{Binding DensityStart,
                                                    Mode=TwoWay,
                                                    UpdateSourceTrigger=PropertyChanged,
                                                    Converter={StaticResource NullableValueConverter}}">
                                <i:Interaction.Triggers>
                                    <be:TextBoxEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </TextBox>
                            <TextBlock Grid.Column="2"
                                       VerticalAlignment="Center"
                                       Text=" 至 " />
                            <TextBox Grid.Column="3"
                                     TabIndex="5"
                                     Text="{Binding DensityEnd,
                                                    Mode=TwoWay,
                                                    UpdateSourceTrigger=PropertyChanged,
                                                    Converter={StaticResource NullableValueConverter}}">
                                <i:Interaction.Triggers>
                                    <be:TextBoxEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </TextBox>
                        </Grid>

                        <Grid Grid.Column="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="80" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Style="{StaticResource style_label_search}" Text="湿度：" />
                            <TextBox Grid.Column="1"
                                     TabIndex="6"
                                     Text="{Binding HumityStart,
                                                    Mode=TwoWay,
                                                    UpdateSourceTrigger=PropertyChanged,
                                                    Converter={StaticResource NullableValueConverter}}">
                                <i:Interaction.Triggers>
                                    <be:TextBoxEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </TextBox>
                            <TextBlock Grid.Column="2"
                                       VerticalAlignment="Center"
                                       Text=" 至 " />
                            <TextBox Grid.Column="3"
                                     TabIndex="7"
                                     Text="{Binding HumityEnd,
                                                    Mode=TwoWay,
                                                    UpdateSourceTrigger=PropertyChanged,
                                                    Converter={StaticResource NullableValueConverter}}">
                                <i:Interaction.Triggers>
                                    <be:TextBoxEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </TextBox>
                        </Grid>
                    </Grid>

                    <Grid Margin="0,12">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="12" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="80" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Style="{StaticResource style_label_search}" Text="温度：" />
                            <TextBox Grid.Column="1"
                                     TabIndex="8"
                                     Text="{Binding TemperatureStart,
                                                    Mode=TwoWay,
                                                    UpdateSourceTrigger=PropertyChanged,
                                                    Converter={StaticResource NullableValueConverter}}">
                                <i:Interaction.Triggers>
                                    <be:TextBoxEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </TextBox>
                            <TextBlock Grid.Column="2"
                                       VerticalAlignment="Center"
                                       Text=" 至 " />
                            <TextBox Grid.Column="3"
                                     TabIndex="9"
                                     Text="{Binding TemperatureEnd,
                                                    Mode=TwoWay,
                                                    UpdateSourceTrigger=PropertyChanged,
                                                    Converter={StaticResource NullableValueConverter}}">
                                <i:Interaction.Triggers>
                                    <be:TextBoxEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </TextBox>
                        </Grid>

                        <Grid Grid.Column="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="80" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Style="{StaticResource style_label_search}" Text="测量时间：" />
                            <!--
                                <TextBox Grid.Column="1" Text="{Binding TemperatureStart, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <i:Interaction.Triggers>
                                <be:TextBoxEnterKeyTrigger>
                                <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                </be:TextBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                                </TextBox>
                            -->
                            <sdk:DatePicker Grid.Column="1"
                                            SelectedDate="{Binding TestTimeStart,
                                                                   Mode=TwoWay,
                                                                   UpdateSourceTrigger=PropertyChanged,
                                                                   Converter={StaticResource NullableValueConverter}}"
                                            TabIndex="10">
                                <i:Interaction.Triggers>
                                    <be:DatePickerEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:DatePickerEnterKeyTrigger>
                                    <i:EventTrigger EventName="SelectedDateChanged">
                                        <ei:CallMethodAction MethodName="SelectedDateChanged" TargetObject="{Binding}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </sdk:DatePicker>
                            <TextBlock Grid.Column="2"
                                       VerticalAlignment="Center"
                                       Text=" 至 " />

                            <sdk:DatePicker Grid.Column="3"
                                            SelectedDate="{Binding TestTimeEnd,
                                                                   Mode=TwoWay,
                                                                   UpdateSourceTrigger=PropertyChanged}"
                                            TabIndex="11">
                                <i:Interaction.Triggers>
                                    <be:DatePickerEnterKeyTrigger>
                                        <be:ExecuteCommandAction Command="{Binding LoadCommand}" />
                                    </be:DatePickerEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </sdk:DatePicker>
                        </Grid>
                    </Grid>



                </StackPanel>
            </toolkit:Expander>

            <toolkit:BusyIndicator Grid.Row="1"
                                   Margin="0,12"
                                   HorizontalAlignment="Stretch"
                                   VerticalAlignment="Stretch"
                                   BusyContent="正在加载数据，请稍后..."
                                   IsBusy="{Binding IsBusy}">
                <sdk:DataGrid AutoGenerateColumns="False"
                              CanUserSortColumns="True"
                              IsReadOnly="True"
                              IsTabStop="True"
                              ItemsSource="{Binding ItemsCollection}">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Width="60"
                                                Binding="{Binding ItemIndex}"
                                                Header="序号" />
                        <sdk:DataGridTemplateColumn Header="设备">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock VerticalAlignment="Center">
                                        <Run Text="{Binding DeviceSn}" />
                                        <Run Text="【" />
                                        <Run Text="{Binding Kind}" />
                                        <Run Text="】" />
                                    </TextBlock>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                        <sdk:DataGridTextColumn MinWidth="100"
                                                Binding="{Binding Name}"
                                                Header="检测项目" />
                        <sdk:DataGridTextColumn MinWidth="100"
                                                Binding="{Binding Density}"
                                                Header="浓度(ppm)" />
                        <!--
                            <sdk:DataGridTextColumn Width="80"
                            Binding="{Binding Temperature}"
                            Header="温度(℃)" />
                            <sdk:DataGridTextColumn Width="80"
                            Binding="{Binding Humidity}"
                            Header="湿度(%)" />
                        -->
                        <sdk:DataGridTextColumn Binding="{Binding Specimen, TargetNullValue=未设置}" Header="样品" />
                        <sdk:DataGridTextColumn Binding="{Binding TestTime, StringFormat=\{0:yyyy-MM-dd HH:mm\}}" Header="时间" />
                        <sdk:DataGridTemplateColumn Header="国标">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <HyperlinkButton Command="{Binding Path=DataContext.ShowGuobiaoDocumentCommand,
                                                                       RelativeSource={RelativeSource AncestorType=navigation:Page}}"
                                                     CommandParameter="{Binding }"
                                                     Content="{Binding Guobiao}" />
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                        <sdk:DataGridTemplateColumn Header="现场照片" Visibility="Visible">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <HyperlinkButton Command="{Binding Path=DataContext.ShowPictureFrameCommand, RelativeSource={RelativeSource AncestorType=navigation:Page}}" Content="点击查看" />
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                        <sdk:DataGridTextColumn Binding="{Binding UserName}" Header="检测单位" />
                        <sdk:DataGridTemplateColumn Header="操作">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <HyperlinkButton Command="{Binding Path=DataContext.ShowItemDetailCommand,
                                                                       RelativeSource={RelativeSource AncestorType=navigation:Page}}"
                                                     CommandParameter="{Binding }"
                                                     Content="详情" />
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
            </toolkit:BusyIndicator>

            <Grid Grid.Row="1"
                  Background="{StaticResource OverlayBrush}"
                  Visibility="{Binding ShowItemDetail,
                                       Converter={StaticResource BooleanToVisibilityConverter}}">

                <Canvas Width="0" Height="0">
                    <Border Canvas.Left="-250"
                            Canvas.Top="-200"
                            Width="500"
                            Height="300"
                            Background="White"
                            CornerRadius="5">
                        <Border.Effect>
                            <DropShadowEffect BlurRadius="10" ShadowDepth="0" />
                        </Border.Effect>
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseLeftButtonDown">
                                <ei:CallMethodAction MethodName="ReadyToMove" TargetObject="{Binding}" />
                            </i:EventTrigger>
                            <i:EventTrigger EventName="MouseMove">
                                <ei:CallMethodAction MethodName="MoveElememt" TargetObject="{Binding}" />
                            </i:EventTrigger>
                            <i:EventTrigger EventName="MouseLeftButtonUp">
                                <ei:CallMethodAction MethodName="CompletedMove" TargetObject="{Binding}" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition />
                            </Grid.RowDefinitions>

                            <!--
                                <controls:PathButton Height="16"
                                Margin="12,6"
                                HorizontalAlignment="Right"
                                Command="{Binding HideItemDetailCommand}"
                                Foreground="{StaticResource COLOR_BLUE}"
                                PathData="{StaticResource ICON_CLOSE}" />
                            -->

                            <Button Margin="12,6"
                                    HorizontalAlignment="Right"
                                    Command="{Binding HideItemDetailCommand}"
                                    Style="{StaticResource CloseImageButtonStyle}" />

                            <StackPanel Grid.Row="1" Margin="12,0">
                                <Grid Margin="0,3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="检测项目：" />
                                    <TextBlock Grid.Column="1"
                                               Foreground="{StaticResource COLOR_DARK}"
                                               Text="{Binding SelectedMeasureItem.Name}" />
                                </Grid>

                                <Grid Margin="0,3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="抽检样品：" />
                                    <TextBlock Grid.Column="1"
                                               Foreground="{StaticResource COLOR_DARK}"
                                               Text="{Binding SelectedMeasureItem.Specimen}" />
                                </Grid>

                                <Grid Margin="0,3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="设备：" />
                                    <TextBlock Grid.Column="1" Foreground="{StaticResource COLOR_DARK}">
                                        <Run Text="{Binding SelectedMeasureItem.DeviceSn}" />
                                        <Run Text="【" />
                                        <Run Text="{Binding SelectedMeasureItem.Kind}" />
                                        <Run Text="】" />
                                    </TextBlock>
                                </Grid>

                                <Grid Margin="0,3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="浓度：" />
                                    <TextBlock Grid.Column="1" Foreground="{StaticResource COLOR_DARK}">
                                        <Run Text="{Binding SelectedMeasureItem.Density}" />
                                        <Run Text=" ppm" />
                                    </TextBlock>
                                </Grid>

                                <Grid Margin="0,3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="湿度：" />
                                    <TextBlock Grid.Column="1" Foreground="{StaticResource COLOR_DARK}">
                                        <Run Text="{Binding SelectedMeasureItem.Humidity}" />
                                        <Run Text=" %" />
                                    </TextBlock>
                                </Grid>

                                <Grid Margin="0,3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="温度：" />
                                    <TextBlock Grid.Column="1" Foreground="{StaticResource COLOR_DARK}">
                                        <Run Text="{Binding SelectedMeasureItem.Temperature}" />
                                        <Run Text=" ℃" />
                                    </TextBlock>
                                </Grid>

                                <Grid Margin="0,3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="检测时间：" />
                                    <TextBlock Grid.Column="1"
                                               Foreground="{StaticResource COLOR_DARK}"
                                               Text="{Binding SelectedMeasureItem.TestTime}" />
                                </Grid>

                                <Grid Margin="0,6">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="检测单位：" />
                                    <TextBlock Grid.Column="1"
                                               Foreground="{StaticResource COLOR_DARK}"
                                               Text="{Binding SelectedMeasureItem.UserName}" />
                                </Grid>

                                <Grid Margin="0,3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="检测人：" />
                                    <TextBlock Grid.Column="1"
                                               Foreground="{StaticResource COLOR_DARK}"
                                               Text="{Binding SelectedMeasureItem.Tester}" />
                                </Grid>

                                <Grid Margin="0,3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Foreground="{StaticResource COLOR_DARK}" Text="源地址：" />
                                    <TextBlock Grid.Column="1"
                                               Foreground="{StaticResource COLOR_DARK}"
                                               Text="{Binding SelectedMeasureItem.MobileOrIP}" />
                                </Grid>
                            </StackPanel>
                        </Grid>
                    </Border>
                </Canvas>
            </Grid>

            <Grid Grid.Row="1"
                  Background="{StaticResource OverlayBrush}"
                  Visibility="{Binding ShowGuobiaoDocument,
                                       Converter={StaticResource BooleanToVisibilityConverter}}">
                <Canvas Width="0" Height="0">
                    <Border Canvas.Left="-360"
                            Canvas.Top="-300"
                            Width="720"
                            Height="480"
                            Background="White"
                            CornerRadius="5">
                        <Border.Effect>
                            <DropShadowEffect BlurRadius="10" ShadowDepth="0" />
                        </Border.Effect>
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseLeftButtonDown">
                                <ei:CallMethodAction MethodName="ReadyToMove" TargetObject="{Binding}" />
                            </i:EventTrigger>
                            <i:EventTrigger EventName="MouseMove">
                                <ei:CallMethodAction MethodName="MoveElememt" TargetObject="{Binding}" />
                            </i:EventTrigger>
                            <i:EventTrigger EventName="MouseLeftButtonUp">
                                <ei:CallMethodAction MethodName="CompletedMove" TargetObject="{Binding}" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <HyperlinkButton Margin="6,0"
                                             HorizontalAlignment="Left"
                                             VerticalAlignment="Center"
                                             BorderThickness="0"
                                             Command="{Binding DownloadGuobiaoFileCommand}"
                                             Content="下载完整文档" />

                            <!--
                                <controls:PathButton Height="16"
                                Margin="12,6"
                                HorizontalAlignment="Right"
                                Command="{Binding HideGuobiaoDocumentCommand}"
                                Foreground="{StaticResource COLOR_BLUE}"
                                PathData="{StaticResource ICON_CLOSE}" />
                            -->
                            <Button Margin="12,6"
                                    HorizontalAlignment="Right"
                                    Command="{Binding HideGuobiaoDocumentCommand}"
                                    Style="{StaticResource CloseImageButtonStyle}" />

                            <toolkit:BusyIndicator Grid.Row="1"
                                                   BusyContent="由于图片文件较大，可能需要一些时间加载，请稍等……"
                                                   IsBusy="{Binding LoadingImage}">
                                <ScrollViewer HorizontalContentAlignment="Stretch" VerticalContentAlignment="Top">
                                    <Image Name="imageViewer" />
                                </ScrollViewer>
                            </toolkit:BusyIndicator>

                        </Grid>
                    </Border>
                </Canvas>
            </Grid>

            <Grid Grid.Row="1"
                  Background="{StaticResource OverlayBrush}"
                  Visibility="{Binding ShowPictureFrame,
                                       Converter={StaticResource BooleanToVisibilityConverter}}">
                <Canvas Width="0" Height="0">
                    <Border Canvas.Left="-360"
                            Canvas.Top="-300"
                            Width="720"
                            Height="480"
                            Background="White"
                            CornerRadius="5">
                        <Border.Effect>
                            <DropShadowEffect BlurRadius="10" ShadowDepth="0" />
                        </Border.Effect>
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseLeftButtonDown">
                                <ei:CallMethodAction MethodName="ReadyToMove" TargetObject="{Binding}" />
                            </i:EventTrigger>
                            <i:EventTrigger EventName="MouseMove">
                                <ei:CallMethodAction MethodName="MoveElememt" TargetObject="{Binding}" />
                            </i:EventTrigger>
                            <i:EventTrigger EventName="MouseLeftButtonUp">
                                <ei:CallMethodAction MethodName="CompletedMove" TargetObject="{Binding}" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>


                            <Button Margin="12,6"
                                    HorizontalAlignment="Right"
                                    Command="{Binding ShowPictureFrameCommand}"
                                    Style="{StaticResource CloseImageButtonStyle}" />

                            <toolkit:BusyIndicator Grid.Row="1"
                                                   BusyContent="正在加载图片，请稍后..."
                                                   IsBusy="{Binding LoadingPicture}">
                                <ScrollViewer HorizontalContentAlignment="Stretch" VerticalContentAlignment="Top">
                                    <Image Name="pictureViewer" />
                                </ScrollViewer>
                            </toolkit:BusyIndicator>

                            <ListBox Grid.Row="2"
                                     Background="Transparent"
                                     BorderThickness="0"
                                     ItemsSource="{Binding PictureThumbnailCollection}"
                                     SelectedItem="{Binding SelectedPicture,
                                                            Mode=TwoWay}">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <VirtualizingStackPanel Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBox.ItemContainerStyle>
                                    <Style TargetType="ListBoxItem">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="ListBoxItem">
                                                    <Grid Width="120"
                                                          Height="80"
                                                          Margin="3">
                                                        <VisualStateManager.VisualStateGroups>
                                                            <VisualStateGroup x:Name="SelectionStates">
                                                                <VisualState x:Name="Unselected" />
                                                                <VisualState x:Name="Selected">
                                                                    <Storyboard>
                                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GreenBorderBrushColor}" />
                                                                        </ColorAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </VisualState>
                                                            </VisualStateGroup>
                                                        </VisualStateManager.VisualStateGroups>
                                                        <Rectangle Fill="White" Opacity="0" />
                                                        <Image Source="{Binding Name, Converter={StaticResource UrlToImageConverter}, ConverterParameter=MeasurePictures}" />
                                                        <Border Name="border"
                                                                BorderBrush="{StaticResource CheckBoxBorderBrush}"
                                                                BorderThickness="2" />
                                                    </Grid>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </ListBox.ItemContainerStyle>
                            </ListBox>

                        </Grid>
                    </Border>
                </Canvas>
            </Grid>

            <controls:PathButton Grid.Row="2"
                                 Width="24"
                                 Height="24"
                                 HorizontalAlignment="Left"
                                 Command="{Binding ShowPrintCommand}"
                                 PathData="{StaticResource ICON_PRINTER}">
                <controls:PathButton.Effect>
                    <DropShadowEffect ShadowDepth="0" />
                </controls:PathButton.Effect>
            </controls:PathButton>

            <StackPanel Grid.Row="2"
                        HorizontalAlignment="Right"
                        Orientation="Horizontal">
                <TextBlock Margin="12,0" VerticalAlignment="Center">
                    <Run Text="共计 " />
                    <Run Text="{Binding ItemsCount}" />
                    <Run Text=" 条数据" />
                </TextBlock>

                <Button Command="{Binding FirstPageCommand}" Style="{StaticResource FirstPageButtonStyle}" />
                <Button Margin="12,0"
                        Command="{Binding PreviousPageCommand}"
                        Style="{StaticResource PreviousPageButtonStyle}" />
                <TextBlock Margin="12,0" VerticalAlignment="Center">
                    <Run Text="{Binding Index}" />
                    <Run Text="/" />
                    <Run Text="{Binding PagesCount}" />
                </TextBlock>
                <Button Margin="12,0"
                        Command="{Binding NextPageCommand}"
                        Style="{StaticResource NextPageButtonStyle}" />
                <Button Command="{Binding LastPageCommand}" Style="{StaticResource LastPageButtonStyle}" />
            </StackPanel>
        </Grid>

        <Grid Visibility="{Binding ShowPrintView, Converter={StaticResource BooleanToVisibilityConverter}}">
            <toolkit:BusyIndicator BusyContent="正在打印报告，请稍候..." IsBusy="{Binding Printing}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Border HorizontalAlignment="Left"
                            BorderBrush="{StaticResource COLOR_DARK}"
                            BorderThickness="0,2,0,0"
                            Padding="0,6">
                        <TextBlock Text="打印检测报告" />
                    </Border>
                    <ScrollViewer Name="contentView"
                                  Grid.Row="1"
                                  Background="#FFFAFFEE"
                                  BorderThickness="0"
                                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                                  Visibility="{Binding ShowPrintOption,
                                                       Converter={StaticResource BooleanToVisibilityInverseConverter}}">
                        <Grid Name="contentGrid" MaxWidth="800">
                            <controls:TiledBackground SourceUri="/Corina.Lantern.Hub;component/Images/WaterMarker.png" />

                            <Grid Margin="20,15">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <StackPanel>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="100" />
                                            <ColumnDefinition />
                                            <ColumnDefinition Width="100" />
                                        </Grid.ColumnDefinitions>
                                        <Image Grid.Row="0"
                                               Width="80"
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Top"
                                               Source="/Corina.Lantern.Hub;component/Images/BOYLOGO.png" />
                                        <TextBlock Grid.Column="1"
                                                   Margin="0,12"
                                                   FontFamily="STXihei"
                                                   FontSize="32"
                                                   Foreground="#FFAB83A6"
                                                   Text="{Binding ReportName}"
                                                   TextAlignment="Center" />
                                    </Grid>

                                    <Grid>
                                        <TextBlock Grid.Row="1"
                                                   HorizontalAlignment="Center"
                                                   VerticalAlignment="Center"
                                                   FontFamily="STSong,宋体"
                                                   FontSize="24"
                                                   FontWeight="Bold"
                                                   Foreground="Black"
                                                   Text="检测报告" />
                                        <StackPanel Grid.Row="1" HorizontalAlignment="Right">
                                            <TextBlock Margin="0,3" Foreground="Black">
                                                <Run Text="证书编号：" />
                                                <Run Text="{Binding CertNumber}" />
                                            </TextBlock>
                                            <TextBlock Margin="0,3" Foreground="Black">
                                                <Run Text="出证日期：" />
                                                <Run Text="{Binding CertAllocateDate, Mode=OneWay, StringFormat=\{0:R\}}" />
                                            </TextBlock>
                                        </StackPanel>
                                    </Grid>

                                    <StackPanel Grid.Row="2">
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="120" />
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Style="{StaticResource style_labeltext}" Text="申请人：" />
                                            <TextBox Style="{StaticResource style_inputbox}" Text="{Binding ReportName, Mode=OneWay}" />
                                        </Grid>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="120" />
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Style="{StaticResource style_labeltext}" Text="申请人地址：" />
                                            <controls:TextBoxExt PlaceText="例如：XX省XX市XX县XXXX路XX号" Style="{StaticResource style_inputbox_ext}" />
                                        </Grid>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="120" />
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Style="{StaticResource style_labeltext}" Text="申报品名：" />
                                            <controls:TextBoxExt PlaceText="请填写被检测物质名称" Style="{StaticResource style_inputbox_ext}" />
                                        </Grid>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="120" />
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Style="{StaticResource style_labeltext}" Text="送样数量：" />
                                            <controls:TextBoxExt PlaceText="送检样品数量" Style="{StaticResource style_inputbox_ext}" />
                                        </Grid>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="120" />
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Style="{StaticResource style_labeltext}" Text="样品描述：" />
                                            <TextBox Style="{StaticResource style_inputbox}" />
                                        </Grid>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="120" />
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Style="{StaticResource style_labeltext}" Text="样品接收时间：" />
                                            <TextBox Style="{StaticResource style_inputbox}" />
                                        </Grid>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="120" />
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Style="{StaticResource style_labeltext}" Text="检测日期：" />
                                            <TextBox Style="{StaticResource style_inputbox}" Text="{Binding PrintTestTime}" />
                                        </Grid>
                                    </StackPanel>

                                    <Grid Margin="0,6">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition />
                                            <ColumnDefinition />
                                            <ColumnDefinition />
                                            <ColumnDefinition />
                                            <ColumnDefinition MinWidth="150" />
                                            <ColumnDefinition MinWidth="150" />
                                            <ColumnDefinition Width="20" />
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Style="{StaticResource style_headertext}" Text="检测项目" />
                                        <TextBlock Grid.Column="1"
                                                   Style="{StaticResource style_headertext}"
                                                   Text="浓度(ppm)" />
                                        <TextBlock Grid.Column="2"
                                                   Style="{StaticResource style_headertext}"
                                                   Text="温度(℃)" />
                                        <TextBlock Grid.Column="3"
                                                   Style="{StaticResource style_headertext}"
                                                   Text="样品" />
                                        <TextBlock Grid.Column="4"
                                                   Style="{StaticResource style_headertext}"
                                                   Text="参照国标" />
                                        <TextBlock Grid.Column="5"
                                                   Style="{StaticResource style_headertext}"
                                                   Text="时间" />
                                    </Grid>

                                    <ListBox Grid.Row="4"
                                             ItemContainerStyle="{StaticResource style_printitem}"
                                             ItemsSource="{Binding PrintItems}"
                                             Style="{StaticResource NoframeListboxStyle}" />
                                    <TextBlock Foreground="Black" TextAlignment="Center">
                                        <Run Text="*表示检测低限" />
                                        <LineBreak />
                                        <Run Text="*****************" />
                                    </TextBlock>


                                </StackPanel>

                                <StackPanel Grid.Row="2">
                                    <StackPanel Grid.Row="5"
                                                Margin="0,24"
                                                HorizontalAlignment="Right">
                                        <Rectangle Height="1"
                                                   MinWidth="150"
                                                   Margin="0,12"
                                                   Fill="Gray" />
                                        <controls:TextBoxExt PlaceText="姓名：" Style="{StaticResource style_inputbox_ext}" />
                                    </StackPanel>
                                    <TextBlock Grid.Row="6">
                                        <Run Foreground="Red" Text="*" />
                                        <Run FontFamily="STFangsong"
                                             FontSize="14"
                                             Foreground="{StaticResource COLOR_GRAY}"
                                             Text=" 以上数据均由设备检测后提供，泊银科技仅对数据进行存储，不对其真实性负责。" />
                                    </TextBlock>
                                </StackPanel>

                            </Grid>
                        </Grid>
                    </ScrollViewer>

                    <Grid Grid.Row="1" Visibility="{Binding ShowPrintOption, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <StackPanel>
                            <TextBlock Text="排序" />
                            <Rectangle Margin="0,6,0,12" Style="{StaticResource BreakLineStyle}" />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="auto" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="排序选项：" />
                                <ListBox Grid.Column="1"
                                         ItemsSource="{Binding OrderCondition}"
                                         SelectedItem="{Binding SelectedSortOption,
                                                                Mode=TwoWay}"
                                         Style="{StaticResource NoframeListboxStyle}">
                                    <ListBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Horizontal" />
                                        </ItemsPanelTemplate>
                                    </ListBox.ItemsPanel>
                                    <ListBox.ItemContainerStyle>
                                        <Style TargetType="ListBoxItem">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="ListBoxItem">
                                                        <RadioButton Margin="6,0"
                                                                     Content="{Binding Value}"
                                                                     IsChecked="{Binding IsSelected,
                                                                                         Mode=TwoWay,
                                                                                         RelativeSource={RelativeSource TemplatedParent}}" />
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </ListBox.ItemContainerStyle>
                                </ListBox>

                                <StackPanel Grid.Column="2" Orientation="Horizontal">
                                    <controls:PathButton Command="{Binding OrderDESCCommand}"
                                                         Foreground="{StaticResource COLOR_LIGHTDARK}"
                                                         PathData="{StaticResource ICON_ROAD_BACKWARD}" />
                                    <controls:PathButton Foreground="{StaticResource COLOR_LIGHTDARK}" PathData="{StaticResource ICON_ROAD_FORWARD}" />
                                </StackPanel>
                            </Grid>

                            <TextBlock Margin="0,12,0,0" Text="排序" />
                            <Rectangle Margin="0,6,0,12" Style="{StaticResource BreakLineStyle}" />
                            <Grid>
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock MinWidth="180" Text="累计打印条目：" />
                                        <TextBlock Text="{Binding PrintItems.Count}" />
                                        <HyperlinkButton Margin="12,0"
                                                         Command="{Binding NextPageCommand}"
                                                         Content="加载更多">
                                            <i:Interaction.Triggers>
                                                <i:EventTrigger EventName="Click">
                                                    <ei:CallMethodAction MethodName="LoadMoreItems" TargetObject="{Binding}" />
                                                </i:EventTrigger>
                                            </i:Interaction.Triggers>
                                        </HyperlinkButton>
                                    </StackPanel>
                                    <StackPanel Margin="0,12" Orientation="Horizontal">
                                        <TextBlock MinWidth="180" Text="被检项目：" />
                                        <ItemsControl ItemsSource="{Binding MeasureProject}">
                                            <ItemsControl.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <toolkit:WrapPanel />
                                                </ItemsPanelTemplate>
                                            </ItemsControl.ItemsPanel>
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <TextBlock Margin="0,0,6,0" Text="{Binding }" />
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                        </ItemsControl>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock MinWidth="180" Text="样品：" />
                                        <ItemsControl ItemsSource="{Binding MeasureSpecimen}">
                                            <ItemsControl.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <toolkit:WrapPanel />
                                                </ItemsPanelTemplate>
                                            </ItemsControl.ItemsPanel>
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <TextBlock Margin="0,0,6,0" Text="{Binding }" />
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                        </ItemsControl>
                                    </StackPanel>
                                </StackPanel>
                            </Grid>
                        </StackPanel>
                    </Grid>

                    <Grid Grid.Row="2" Margin="0,6">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <CheckBox Margin="12,0"
                                  VerticalAlignment="Center"
                                  Content="选项和数据"
                                  IsChecked="{Binding ShowPrintOption,
                                                      Mode=TwoWay}"
                                  Style="{StaticResource style_dataoption}" />

                        <StackPanel Grid.Column="1"
                                    HorizontalAlignment="Right"
                                    Orientation="Horizontal">
                            <Button Command="{Binding Path=DataContext.SaveAsPoictureCommand,
                                                      RelativeSource={RelativeSource AncestorType=navigation:Page}}"
                                    CommandParameter="{Binding ElementName=contentGrid}"
                                    Content="保存为图片"
                                    Style="{StaticResource GreenButton}" />
                            <Button Margin="12,0"
                                    Content="开始打印"
                                    Style="{StaticResource GreenButton}">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <i:InvokeCommandAction Command="{Binding Path=DataContext.PrintCommand, RelativeSource={RelativeSource AncestorType=navigation:Page}}" CommandParameter="{Binding ElementName=contentGrid}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Command="{Binding HidePrintCommand}" Content="取消" />
                        </StackPanel>
                    </Grid>
                </Grid>
            </toolkit:BusyIndicator>
        </Grid>
    </Grid>
</navigation:Page>
